Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> table, td { border: 1px solid black; } </style> </head> <body> <p>Click on each td element to alert its position in the table row.</p> <table> <tr> <td onclick="myFunction(this)">Click to show cellIndex</td> <td onclick="myFunction(this)">Click to show cellIndex</td> <td onclick="myFunction(this)">Click to show cellIndex</td> <td onclick="myFunction(this)">Click to show cellIndex</td> </tr> </table> <script> function myFunction(x) { alert("Cell index is: " + x.cellIndex); } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_td_cellindex by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:35:08 GMT --> </html>
Result:
Try it Yourself - © w3schools.com